<!DOCTYPE html>
<html>
<head>
    <title>个人中心首页 {$site_info.site_name|default=''}</title>
    <meta name="keywords" content="{$site_info.site_seo_keywords|default=''}"/>
    <meta name="description" content="{$site_info.site_seo_description|default=''}">
    <include file="public@mobile_head"/>
    <hook name="before_head_end"/>

</head>
<body class="page-personal">
<div class="headers">
	<span onclick="window.history.back(); ">←</span>
	<p>个人中心</p>
	<span></span>
</div>
<div class="page">
	<!--<div class="header">-->
		<!--<div class="avatar"><a href="{:url('change_info')}"><img src="{$data.user.avatar}" alt="{$data.user.user_nickname}"></a></div>-->
		<!--<div class="details">-->
			<!--<div class="line name-box"><span class="name"> {$data.user.user_nickname}</span> |-->

				<!--<span class="badage"><i class="icon-diomand"></i><span></span></span>-->

			<!--</div>-->
			<!--<div class="line rank-time"><span class="time"><i class="icon-hour"></i><span>  <text>活动时长：{$data.duration|s_to_h}</text></span></span></div>-->
			<!--<div class="line rank-time"><span class="time"><i class="icon-ming"></i><span> <text> 活动次数：{$data.times}</text></span></span></div>-->
		<!--</div>-->
	<!--</div>-->
	<div class="contents">
		<div class="navbar shadow-box-5">
			<div class="nav-item">
				<p>总积分</p>
				<p>{$data.all_points}分</p>
			</div>
			<text class="grdalineSty">|</text>
			<div class="nav-item">
				<p>当前可用</p>
				<p>{$data.can_points}分</p>
			</div>

			<text class="grdalineSty">|</text>
			<div class="nav-item">
				<p>已使用</p>
				<p>{$data.used_points}分</p>
			</div>
			<text class="grdalineSty">|</text>
			<div class="nav-item">
				<p>兑换券</p>
				<p>{$list|count}张</p>
			</div>

		</div>

		<div class="layui-collapse " lay-accordion>
			<!--<div class="layui-colla-item ">-->
				<!--<h2 class="layui-colla-title"><i class="layui-icon layui-icon-release glIcon"></i>活动管理</h2>-->
				<!--<div class="layui-colla-content">-->
					<!--<div class="jlBlock">-->
						<!--<table class="layui-table" lay-skin="nob">-->
							<!--<colgroup>-->
								<!--<col>-->
								<!--<col>-->
								<!--<col>-->
							<!--</colgroup>-->
							<!--<thead>-->
							<!--<tr>-->
								<!--<th>时间</th>-->
								<!--<th>地点</th>-->
								<!--<th>状态</th>-->
							<!--</tr>-->
							<!--</thead>-->
							<!--<tbody>-->

							<!--</tbody>-->
						<!--</table>-->
					<!--</div>-->
				<!--</div>-->
			<!--</div>-->
			<!--<div class="layui-colla-item">-->
				<!--<h2 class="layui-colla-title"><i class="layui-icon layui-icon-template-1 glIcon"></i>兑分列表</h2>-->
				<!--<div class="layui-colla-content">-->
					<!--<div class="jlBlock">-->
						<!--<table class="layui-table" lay-skin="nob" style="text-align: center;">-->
							<!--<colgroup>-->
								<!--<col>-->
								<!--<col>-->
								<!--<col>-->
							<!--</colgroup>-->
							<!--<thead>-->
							<!--<tr>-->
								<!--<th>名称</th>-->
								<!--<th>积分(分)</th>-->
								<!--<th>兑换</th>-->
							<!--</tr>-->
							<!--</thead>-->
							<!--<tbody>-->
							<!--<foreach name="points" id="vo">-->
								<!--<tr>-->
									<!--<td>{$vo.name}</td>-->
									<!--<td>{$vo.point}</td>-->
									<!--<td>-->
										<!--<div class="inBtn">-->
											<!--<button type="button" class="layui-btn jfd" data-id="{$vo.id}" data-name="{$vo.name}" data-point="{$vo.point}">积分兑换</button>-->
										<!--</div>-->
									<!--</td>-->
								<!--</tr>-->
							<!--</foreach>-->
							<!--</tbody>-->
						<!--</table>-->
					<!--</div>-->
			<!--</div>-->
			</div>
			<div class="layui-colla-item">
				<h2 class="layui-colla-title"><i class="layui-icon layui-icon-form glIcon"></i>实物列表</h2>
				<div class="layui-colla-content">
					<div class="jlBlock">
						<table class="layui-table" lay-skin="nob">
							<colgroup>
								<col>
								<col>
								<col>
							</colgroup>
							<thead>
							<tr>
								<th>名称</th>
								<th>积分(分)</th>
								<th>兑换</th>
							</tr>
							</thead>
							<tbody>
							<foreach name="goods" id="vo">
								<tr>
									<td>{$vo.name}</td>
									<td>{$vo.point}</td>
									<td>
										<div class="inBtn">
											<button type="button" class="layui-btn jfd" data-id="{$vo.id}" data-name="{$vo.name}" data-point="{$vo.point}">积分兑换</button>
										</div>
									</td>
								</tr>
							</foreach>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<!--<div class="layui-colla-item">-->
				<!--<a href="{:url('change_info')}"><h2 class="layui-colla-title"><i class="layui-icon layui-icon-edit glIcon"></i>个人信息修改</h2>-->

			<!--</div>-->
			<div class="layui-colla-item">
				<a href="{:url('point_log_detail')}"><h2 class="layui-colla-title"><i class="layui-icon layui-icon-diamond glIcon"></i>积分兑换记录</h2>

			</div>
			</div>

		</div>



	</div>
	<!--<a href="logout"><button type="button" class="exit">退出</button></a>-->
	<a href="logout"><button type="button" class="exit">切换账号</button></a>



	<ul class="layer_notice" style="display: none;">
		<li id="show"></li>
	</ul>




<!--<include file="public@mobile_footer_nav">-->
<include file="public@mobile_footer">
	<script type="text/javascript" src="__TMPL__/public/assets/js/clipboard.min.js"></script>

</div>

<div class="exc-pannel" style="display: hidden;">
	
</div>
<script type="text/javascript">
	layui.use(['element', 'layer'], function(){
		var element = layui.element
				,layer = layui.layer;

		element.on('tab(docDemoTabBrief)', function(data){
			layer.msg('切到到了'+ data.index + '：' + this.innerHTML);
		});
	});
	layui.use(['form','laydate','laypage','layer'], function(){
		var form = layui.form
				,laydate = layui.laydate
				,laypage = layui.laypage
				, layer = layui.layer;
		var tc;
		// 积分兑换
		$(".jfd").on('click',function (e) {
			var data=e.target.dataset
			id=data.id
			var str='您确定使用'+data.point+'个积分兑换'+data.name+'吗?'
			layer.msg(str, {
				time: 0 //不自动关闭
				,btn: ['必须啊', '算了先']
				,yes: function(index){
					$.ajax({
						type: "GET",
						url: "/portal/personal/exchange",
						data: {'id':id},
						dataType: "json",
						success: function(data){
							layer.msg(data.msg);
							if(data.code==1){
								window.location.reload()
							}
						}
					});
					layer.close(index);
				}
			});
			//$(".tishiCon").html(str)
			//示范一个公告层
		});

		$(".dhBtn").on('click',function (e) {
			console.log(id)
			$.ajax({
				type: "GET",
				url: "/portal/personal/exchange",
				data: {'id':id},
				dataType: "json",
				success: function(data){
					layer.msg(data.msg);
					layer.close(tc);
					if(data.code==1){
						window.location.reload()
					}
				}
			});
		});

		$(".qxBtn").on('click',function () {
			layer.close(tc);
		});

//		$(".show").on('click',function (e) {
//			var code = e.target.dataset.code
//			var str='您的校验码为&nbsp;：&nbsp;'+code
//			$("#show").html(str)
//			layer.open({
//				type: 1,
//				shade: false,
//				title: false, //不显示标题
//				content: $('.layer_notice'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
//				cancel: function(){
//					layer.msg('已经成功获取并关闭校验码', {time: 1500, icon:6});
//				}
//			});
//		})
		$(".show").on('click',function (e) {
			var code = e.target.dataset.code
			var str='您的校验码为&nbsp;：&nbsp;'+code
			new ClipboardJS('.show',{text:function(trigger) { return code;} });
			console.log(code)
			layer.msg('已经成功复制校验码到粘贴板', {time: 1500, icon:6});
		})

		$(".del").on('click',function(e){
			var id=e.target.dataset.id
			layer.msg('确定要删除么？', {
				time: 0 //不自动关闭
				,btn: ['是滴', '算了']
				,yes: function(index){
					$.ajax({
						type: "GET",
						url: "log_del",
						data: {'id':id},
						dataType: "json",
						success: function(data){
							console.log(data)
							layer.msg(data.msg);
							layer.close(tc);
							if(data.code==1){
								layer.close(index);
								layer.msg('删除成功！', {time: 2000, icon:6},window.location.reload());
							}
						}
					});

				}
			});
		})
	});
(function($){
	"use strict";
		function bind_events(){
			$('.btn-exchange').off("click").on("click",function(e){
				e.preventDefault();
				show_exc_pannel();
			});
		}
		function show_exc_pannel(){
			$('.exc-pannel').show();
		}
      $(function(){
      		bind_events();
      })


})(jQuery)


</script>
</body>
</html>